<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="10" />

    <title><?php echo ($storeData["local_name"]); ?>-怡臣优选</title>
    <link rel="stylesheet" href="/Public/Home/css/swiper.min.css">
    <link rel="stylesheet" href="/Public/Home/css/home.css?v=20170515001">
    <script type="text/javascript">
		//是否直接头部使用自动配置
    	var yc_wx_useInHeader = false;
		//是否使用自动定位
		var yc_wx_location = false;
    </script>
    <!--不识别数字为手机-->
<meta name="format-detection" content="telephone=no, email=no"/>
<!--通用js-->
<?php if(isset($signPackage) && !empty($signPackage)){ ?>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js?v=201704270010"></script>
<?php } ?>
<script type="text/javascript" src="/Public/Home/js/require.js"></script>
<script type="text/javascript" src="/Public/Home/js/baseLoading.js?v=201705240001"></script>
<script src="/Public/Home/js/jquery.min.js" ></script>
<script src="/Public/Home/js/pincode-input.js" ></script>
<script src="/Public/Home/js/parabola.js" ></script>
<script src="/Public/Home/js/lazyload/jquery.lazyload.min.js"></script>
<script type="text/javascript">
    _global.isLogin = !!"<?php echo $wx_member_id; ?>";
	var isWxShareDiy = typeof yc_share_diy === "undefined" ? false : yc_share_diy;
	var yc_wx_shareImgPath = "";
	<?php if(isset($weixin_logo) && !empty($weixin_logo)){ ?>
		yc_wx_shareImgPath = "/Uploads/<?php echo ($weixin_logo["image"]); ?>";
	<?php } ?>
    var yc_pass_arr = {'local_id':"<?php echo I('local_id',1);?>",'top_local_id':"<?php echo I('top_local_id',1);?>"};
	if(parseInt(yc_pass_arr["local_id"]) == 21){
		_global.isStopSell = true;
	}
    <?php if(isset($signPackage) && !empty($signPackage)){ ?>
        _global.isWeiXinLoad = true;
        var isEnableLocation = typeof yc_wx_location === "undefined" ? false : yc_wx_location;
        var yc_wx_options = {
            "enableLocation" : isEnableLocation,
            "refuseCallback" : function(){},
            "mapCallback" : function(){},
            "config" : {
                debug: false,
                appId: '<?php echo $signPackage["appId"];?>',
                timestamp: '<?php echo $signPackage["timestamp"];?>',
                nonceStr: '<?php echo $signPackage["nonceStr"];?>',
                signature: '<?php echo $signPackage["signature"];?>',
                jsApiList: [
                    'checkJsApi'
                ]
            }
        };
        var isInHeader = typeof yc_wx_useInHeader === "undefined" ? true : yc_wx_useInHeader;
        if(isInHeader){
            wxAutoConfig(yc_wx_options);
        }
    <?php } ?>
</script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=<?php echo ($ak); ?>"></script>
</head>
<body>
    <div class="warp" style="padding-bottom:1.1rem;">
        <!-- 门店选择 -->
        <div class="shop-entry">
            <div class="shop-current">
                <a href="<?php echo url('First/stortSelect');?>" class="location-icon"></a>
                <a href="<?php echo url('First/stortSelect');?>" class="shop h3"><?php echo ($storeData["local_name"]); ?></a>
            </div>
        </div>
        <!-- 搜索 -->
        <div class="fixed-search"><a href="<?php echo url('Search/index');?>"></a></div>
        <div style="height: 0.82rem;"></div>

        <div class="swiper-container">
            <!--轮播-->
            <div class="swiper-wrapper">
                <?php if(is_array($carousel)): foreach($carousel as $key=>$v): if($v['type'] == '图链接'): ?><div class="swiper-slide"><a href="<?php echo ($v["url"]); ?>"><img src="/Uploads/<?php echo ($v['img']); ?>"></a></div>
                        <?php elseif($v['type'] == '产品详情'): ?>
                        <div class="swiper-slide"><a href="<?php echo url('goods/detail',['id'=>$v[value], 'local_id' =>$storeData['local_id']]);?>"><img src="/Uploads/<?php echo ($v['img']); ?>"></a></div>
                        <?php elseif($v['type'] == '产品列表'): ?>
                        <div class="swiper-slide"><a href="/home/store/goods_list/id/<?php echo ($v['id']); ?>/type/carousel/local_id/<?php echo ($storeData["local_id"]); ?>"><img src="/Uploads/<?php echo ($v['img']); ?>"></a></div>
                        <?php elseif($v['type'] == '文章列表'): ?>
                        <div class="swiper-slide"><a href="<?php echo ($v["url"]); ?>"><img src="/Uploads/<?php echo ($v['img']); ?>"></a></div><?php endif; endforeach; endif; ?>
            </div>
            <!-- Add Pagination -->
            <div class="swiper-pagination"></div>
        </div>

        <!-- 门店加粉丝关注-->
        <?php if ($storeData['is_self'] != 1){ ?>
        <div class="shop-attention">
            <div class="shop-attention-name">
                <h3><?php echo ($storeData["local_name"]); ?></h3>
                <span><font><?php echo ($member_like_store); ?></font>粉丝</span>
            </div>
            <a class="weixin-attention <?php if($member_store_data == false ): ?>active<?php endif; ?>" data-localId="<?php echo ($storeData['local_id']); ?>">关注</a>
        </div>
        <?php } ?>
        <?php ?>
        <!-- 主菜单 -->
        <div class="main-nav clearfix mgTop">
            <?php if(is_array($shortcutMsg)): foreach($shortcutMsg as $key=>$v): if($v['type'] == '图链接'): if(strpos($v[url],'http') === false): ?><a href="<?php echo url($v['url'])?>">
                            <span><img style="" class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/<?php echo ($v['img']); ?>"></span>
                            <p><?php echo ($v["name"]); ?></p>
                        </a>
                        <?php else: ?>
                        <a href="<?php echo ($v["url"]); ?>">
                            <span><img style="" class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/<?php echo ($v['img']); ?>"></span>
                            <p><?php echo ($v["name"]); ?></p>
                        </a><?php endif; ?>

                    <?php elseif($v['type'] == '产品详情'): ?>
                    <a href="<?php echo url('goods/detail',['id'=>$v[value], 'local_id' => $storeData['local_id']]);?>">
                        <span><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/<?php echo ($v['img']); ?>"></span>
                        <p><?php echo ($v["name"]); ?></p>
                    </a>
                    <?php elseif($v['type'] == '产品列表'): ?>
                    <a href="<?php echo url('store/goods_list',['id'=>$v[id], 'local_id' => $storeData['local_id']]);?>">
                        <span><img  class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/<?php echo ($v['img']); ?>"></span>
                        <p><?php echo ($v["name"]); ?></p>
                    </a><?php endif; endforeach; endif; ?>
        </div>
        <!--广告模块-->

        <?php if(!empty($advertId)): ?><div class="activity">
                <a href="<?php echo ($advertUrl); ?>"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/<?php echo ($advertImage); ?>" alt=""></a>
            </div><?php endif; ?>





        <!-- 活动板块 -->
        <?php if(is_array($specialMsg)): foreach($specialMsg as $key=>$v): ?><div class="activity mgTop">
            <a href="<?php echo url('Store/viewTemplate', array('id'=>$v['id'], 'local_id' => $storeData['local_id']),'');?>"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/<?php echo ($v['img_url']); ?>" alt=""></a>
            <h2 class="pdLR"><p><span class="red"><?php echo ($v["price_desc"]); ?></span><span><?php echo ($v["title"]); ?></span></p><p class="gray">仅剩<?php echo ($v["end_time"]); ?>天</p></h2>
        </div><?php endforeach; endif; ?>
        <!-- 促销板块 -->
        <div class="promotion-goods mgTop">
            <div class="goods-horizontal">

                <?php if(is_array($maShangMaiMsg)): foreach($maShangMaiMsg as $key=>$v): ?><div class="goods-item clearfix">
                    <a href="<?php echo url('Goods/detail', array('id'=>$v['store_pid'], 'local_id' => $storeData['local_id']),'');?>" class="img <?php echo ($v['store']-$v['freez']) <=0 ? 'img sold_out' : ''; ?>"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="<?php echo (getthumb($v["goods_id"])); ?>"></a>
                    <div class="text">
                        <a href="<?php echo url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']]);?>" class="goods-name"><?php echo ($v["name"]); ?></a>
                        <p class="goods-norms">
                            <?php echo ($v["spec_info"]); ?>                            
                        </p>
                        <p class="gmarks">
                        	<?php if(!empty($v['proPrice']) and ($v['proPrice'] != $v['price'])): ?><i>促销</i><?php endif; ?>
                            <?php if(!empty($v['flashGoods'])): ?><i>闪购</i><?php endif; ?>
                            <?php if($v['groupPromotion'] == true): ?><i>套餐</i><?php endif; ?>
                        </p>
                        <?php if(!empty($v['proPrice']) and ($v['proPrice'] != $v['price'])): ?><p class="sale-price">￥<?php echo ($v["proPrice"]); ?></p>
                            <p class="old-price">￥<?php echo ($v["price"]); ?></p>
                        <?php else: ?>
                            <?php if(!empty($v['flashGoods'])): ?><p class="sale-price"><span>￥<?php echo (number_format($v['flashGoods']['promotion_price'], 2, '.', '')); ?></span></p>
                                <?php else: ?>
                                <p class="sale-price"><span>￥<?php echo ($v['price']); ?></span></p><?php endif; endif; ?>
                        <a href="<?php echo url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']]);?>" class="btn-buy">马上买</a>
                    </div>
                </div><?php endforeach; endif; ?>
            </div>
        </div>
        <!-- 推荐商品 -->
        <div class="recommand-box mgTop">
            <div class="title_01"><span>推荐</span></div>
            <div class="recommand-list">

                <?php if(is_array($tuiJianMsg)): foreach($tuiJianMsg as $key=>$v): ?><div class="goods-item">
                    <a href="<?php echo url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']]);?>" class="img"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="<?php echo (getthumb($v["goods_id"])); ?>"></a>
                    <a href="<?php echo url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']]);?>" class="name text-hide"><?php if(!empty($v['proPrice']) and ($v['proPrice'] != $v['price'])): ?><i class="o-mark">促销</i><?php endif; if(!empty($v['flashGoods'])): ?><i class="o-mark">闪购</i><?php endif; if($v['groupPromotion'] == true): ?><i class="o-mark">套餐</i><?php endif; echo ($v["name"]); ?></a>
                    <p href="<?php echo url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']]);?>" class="des text-hide">
                        <?php echo ($v["spec_info"]); ?>                        
                    </p>
                    <?php if(!empty($v['proPrice']) and ($v['proPrice'] != $v['price'])): ?><p class="price">
                            <span>￥<?php echo ($v['proPrice']); ?></span>
                            <label>￥<?php echo ($v['price']); ?></label>
                        </p>
                    <?php else: ?>
                        <?php if(!empty($v['flashGoods'])): ?><p class="price"><span>￥<?php echo (number_format($v['flashGoods']['promotion_price'], 2, '.', '')); ?></span></p>
                            <?php else: ?>
                                <p class="price"><span>￥<?php echo ($v['price']); ?></span></p><?php endif; endif; ?>
                </div><?php endforeach; endif; ?>
            </div>
        </div>
    </div>
    <input type="hidden" id="stortSelect" value="<?php echo ($stortSelect); ?>">
    <!-- 网站主菜单 -->
    <link rel="stylesheet" href="/Public/Home/css/menu.css">
<div class="fixed-main-menu">

    <?php
 $home_default_local_id = (!empty($_GET['top_local_id']) && $_GET['top_local_id'] != '11') ? $_GET['top_local_id'] : $default_local_id; ?>
    <?php if ($_GET['local_id'] == '11'){ ?>
        <a href="<?php echo url('store/index',['local_id' => $home_default_local_id, 'top_local_id' => 11]);?>" class="home <?php echo CONTROLLER_NAME == 'Store' ? 'active' : ''; ?>"><span></span>
            <p>首页</p>
        </a>
    <?php }else { ?>
        <a href="<?php echo url('store/index',['local_id' => $storeData['local_id']]);?>" class="home <?php echo CONTROLLER_NAME == 'Store' ? 'active' : ''; ?>"><span></span>
            <p>首页</p>
        </a>
    <?php } ?>

    <?php if ($_GET['local_id'] == '11'){ ?>
    <a href="<?php echo url('category/index', ['local_id' => $home_default_local_id, 'top_local_id' => 11]);?>" class="category <?php echo CONTROLLER_NAME == 'Category' ? 'active' : ''; ?>"><span></span>
        <p>分类</p></a>
    <?php }else { ?>
    <a href="<?php echo url('category/index', ['local_id' => $storeData['local_id']]);?>" class="category <?php echo CONTROLLER_NAME == 'Category' ? 'active' : ''; ?>"><span></span>
        <p>分类</p></a>
    <?php } ?>

    <?php if ($_GET['local_id'] == '11'){ ?>
    <a href="<?php echo url('store/index', ['local_id' => '11']);?>" class="store-way <?php echo ($_GET['local_id'] == '11') ? 'active' : '';?>"><span></span><p>全国送</p></a>
    <?php }else { ?>
    <?php $top_local_id = (!empty($_GET['local_id'])) ? $_GET['local_id'] : $storeData['local_id']; ?>
    <a href="<?php echo url('store/index', ['local_id' => '11','top_local_id' => $top_local_id]);?>" class="store-way <?php echo ($_GET['local_id'] == '11') ? 'active' : '';?>"><span></span><p>全国送</p></a>
    <?php } ?>

    <a href="<?php echo url('carts/cart');?>" class="cart <?php echo CONTROLLER_NAME == 'Carts' ? 'active' : ''; ?> clickable_shou"><span></span>
        <p>购物车</p>

            <?php if(userCartNum()): ?><label class="public-cart-number"><?php echo userCartNum();?></label><?php endif; ?>
    </a>
    <a href="<?php echo url('Member/index');?>" class="mine <?php echo CONTROLLER_NAME == 'Member' ? 'active' : ''; ?> clickable_shou" id="menuMemberPopup"><span></span><p>我的</p></a>
</div>
<link rel="stylesheet" href="/Public/Home/css/phoneCheck.css">
<div class="alert-popup bindPhone">
    <p>你还没有绑定手机号，为了你更好的体验怡臣请先绑定手机号。</p>
    <p><a href="javascript:void(0);" class="cancel">先看看</a><a href="javascript:void(0);" class="confirm">绑定手机</a></p>
</div>
<div class="bindPhone-box" style="display:none">
    <span class="close"></span>
    <div class="inputInfo">
        <h1>验证手机号</h1>
        <ul>
            <li><input type="text" placeholder="请输入绑定手机号" id="phone"> <a href="javascript:void(0);" id="yzCaptcha">获取验证码</a></li>
            <li>
                <div class="pincode-input-container touch" id="pincode-list">
                    <div style="display: none;">
                        <input type="password" readonly pattern="[0-9]*" inputmode="numeric" id="preventautofill" autocomplete="off">
                    </div>
                    <div class="touchwrapper touch4">
                        <input type="password" pattern="[0-9]*" readonly inputmode="numeric" maxlength="4" autocomplete="off" class="form-control pincode-input-text">
                        <table class="touchtable">
                            <tbody>
                            <tr>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td class="last"></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="text-danger pincode-input-error"></div>
                </div>
                <input type="text" id="code-input" style="display:none;">
                <p class="code-tips" style="display:none;"></p>
            </li>
        </ul>
    </div>
    <div class="success" style="display:none;">
        <ul>
            <li>
                <span>绑定成功!</span>
                <p>该窗口<i>3</i>秒后自动关闭</p>
            </li>
        </ul>
    </div>
</div>

<script type="text/javascript">
    $(".clickable_shou").click(function(e){
        _global.checkPhoner.reset();
        _global.checkPhoner.run(e, $(this).attr('href'));
    });
</script>


    
    <script src="/Public/Home/js/main.js?v=201703010001"></script>
    <script type="text/javascript">

        var source = "<?php echo ($source); ?>";//已选择
        var self_store = "<?php echo ($is_self); ?>";//1-为全国送
        var yc_data_province = "<?php echo ($storeData[province]); ?>";
        var yc_data_city = "<?php echo ($storeData[city]); ?>";
        var yc_data_area = "<?php echo ($storeData[area]); ?>";
        var yc_data_url = "<?php echo url('First/stortSelect');?>";
		function mapCallback(lat, lng){
			BMapGetLocation(lng, lat);
		}
		function saveUserOperation(){
			var timestamp = Date.parse(new Date());								
			timestamp = timestamp / 1000;
			_global.cacher.set("time", timestamp);
			_global.cacher.set("stortSelect", 1); 
		}
		function BMapGetLocation(lng, lat){
			var pt = new BMap.Point(lng, lat);
			var gc = new BMap.Geocoder();
			var addComp;
			//获取地址的数据地址
			gc.getLocation(pt, function (rs) {
				addComp = rs.addressComponents;
				var province = addComp.province;
				var city     = addComp.city;
				var district     = addComp.district;
				if(province != yc_data_province || city != yc_data_city || district != yc_data_area){
					saveUserOperation();
					if (confirm("你目前的位置已经不在<?php echo ($storeData[local_name]); ?>范围内了，是否切换附近门店？")) {
						window.location.href = yc_data_url;
					}
				}
			});
		}		
		if(_global.isWeiXinLoad){
			yc_wx_options["refuseCallback"] = saveUserOperation;
			yc_wx_options["mapCallback"] = mapCallback;
		}
        function exeBaiduMap(){
            //读本地存储（取消切换店铺的值）
            var timelop;
            var stortSelect;
            var _timestamp = Date.parse(new Date());
            _timestamp = _timestamp / 1000;
			timelop = _global.cacher.get('time');
			stortSelect = _global.cacher.get('stortSelect');
            //是否有本地存储
            if(timelop && stortSelect){
                //时间超过一天清空本地存储
                if((_timestamp - timelop) > 86400){
					_global.cacher.remove("time");
					_global.cacher.remove("stortSelect");
                    stortSelect = 0;
                }else{
					return;	
				}
            }else{
                stortSelect = 0;
            }
            if(source == 1 && stortSelect != 1 && self_store != 1) {
                yc_wx_options["enableLocation"] = true;
            }
			wxAutoConfig(yc_wx_options);
        }
		exeBaiduMap();
   </script>
</body>
</html>